using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using ViCode_LeVi.Controls.Logs;
using ViCode_LeVi.Controls.Charts;

namespace ViCode_LeVi.Controls.Reports
{
    public partial class BarChartImportanceSubReport : DevExpress.XtraReports.UI.XtraReport
    {
        private string m_sInterpretation = string.Empty;
        
        public BarChartImportanceSubReport()
        {
            this.InitializeComponent();
        }

        public bool CreateReport(BarChartImportance oChartCtrl, ref int riNumberOfElements)
        {
            bool flag = true;
            try
            {                
                if (oChartCtrl != null)
                {
                    this.m_oChartCtrl1.ChartLabelMode = oChartCtrl.ChartLabelMode;
                    this.m_oChartCtrl1.LabelWithPercent = oChartCtrl.LabelWithPercent;
                    this.m_oChartCtrl1.ChartLegendMode = oChartCtrl.ChartLegendMode;
                    this.m_oChartCtrl1.LegendWithPercent = oChartCtrl.LegendWithPercent;
                    this.m_oChartCtrl1.valuesbereich = oChartCtrl.valuesbereich;
                    this.m_oChartCtrl1.ChartBackColor = Color.White;
                    this.m_oChartCtrl1.Func_GetStep_TaskItemGroup = oChartCtrl.Func_GetStep_TaskItemGroup;
                }
                else
                {
                    this.m_oChartCtrl1.ReadOptions();
                }
                flag = this.m_oChartCtrl1.CreateChart();
                riNumberOfElements = this.m_oChartCtrl1.NumberOfElements;
            }
            catch (Exception exception)
            {
                flag = false;
                //rsErr = "Fehler in BarChartSubReport.CreateReport: " + exception.Message;
                Log.LogException(exception);
            }
            return flag;
        }
        
      

        public string Interpretation
        {
            get
            {
                return this.m_sInterpretation;
            }
            set
            {
                this.m_sInterpretation = value;
                this.cellInterpretation.Text = ReportTemplate.GetInterpretationString(this.m_sInterpretation);
            }
        }

    }
}
